CentOS 6
Sponsored Link

Configure NIS Slave
2015/03/08
 
Configure NIS Slave Server to continue NIS service if NIS master server would be down.
[1]
[2] Install and Configure Ypserv on NIS Slave Server.
If IPTables is running, allow NIS ports on it, refer to here for section [3].
[root@slave ~]#
yum -y install ypserv rpcbind
# set NIS domain

[root@slave ~]#
ypdomainname srv.world

[root@slave ~]#
echo 'NISDOMAIN=srv.world' >> /etc/sysconfig/network

[root@slave ~]#
vi /var/yp/securenets
# create new (specify networks you allow to access)

255.0.0.0       127.0.0.0
255.255.255.0   10.0.0.0

[root@slave ~]#
vi /etc/hosts
# add own and NIS master's IP

10.0.0.30   dlp.srv.world dlp
10.0.0.50   slave.srv.world slave

[root@slave ~]#
/etc/rc.d/init.d/rpcbind start

Starting portmap:     [  OK  ]
[root@slave ~]#
/etc/rc.d/init.d/ypserv start

Starting YP server services:     [  OK  ]
[root@slave ~]#
/etc/rc.d/init.d/ypxfrd start

Starting YP server services:     [  OK  ]
[root@slave ~]#
/etc/rc.d/init.d/yppasswdd start

Starting YP passwd service:     [  OK  ]
[root@slave ~]#
chkconfig rpcbind on

[root@slave ~]#
chkconfig ypserv on

[root@slave ~]#
chkconfig ypxfrd on

[root@slave ~]#
chkconfig yppasswdd on
# sync with NIS master

[root@slave ~]#
/usr/lib64/yp/ypinit -s dlp.srv.world

We will need a few minutes to copy the data from dlp.srv.world.
Transferring group.bygid...
Trying ypxfrd ... success
...
...
At this point, make sure that /etc/passwd and /etc/group have
been edited so that when the NIS is activated, the data bases you
have just created will be used, instead of the /etc ASCII files.
[3]
NIS master server is also required to be a NIS client.
Configure NIS master server as a NIS Client, refer to here.
[4] Configure on NIS master server for new NIS Slave.
[root@dlp ~]#
vi /var/yp/Makefile
# line 23: change

NOPUSH=
false
# update NIS database

[root@dlp ~]#
/usr/lib64/yp/ypinit -m


At this point, we have to construct a list of the hosts which will run NIS
servers.  dlp.srv.world is in the list of NIS server hosts.  Please continue to add
the names for the other hosts, one per line.  When you are done with the
list, type a <control D>.
        next host to add:  dlp.srv.world
       
# specify NIS slave

        next host to add:
slave.srv.world

        next host to add:    
# Ctrl + D key

The current list of NIS servers looks like this:

dlp.srv.world
slave.srv.world

Is this correct? [y/n: y]
y

We need a few minutes to build the databases...
Building /var/yp/srv.world/ypservers...
...
...
Now you can run ypinit -s dlp.srv.world on all slave server.
[5] Configure on NIS Client to bind NIS slave, too.
[root@www ~]#
vi /etc/yp.conf
# add slave server's setting to the end

domain srv.world server dlp.srv.world
domain srv.world server slave.srv.world
[root@www ~]#
/etc/rc.d/init.d/ypbind restart

Shutting down NIS service: [ OK ]
Starting NIS service: [ OK ]
Binding NIS service: [ OK ]
 
Tweet